﻿function getinfo(_0xde7dx2) {
    ajax('/SystemSetting/GetUserRule/' + _id, {}, function (_0xde7dx3) {
        if (_0xde7dx3 != null) {
            $('#id')['val'](_0xde7dx3['id']);
            $('#title')['val'](_0xde7dx3['title']);
            $('#title_sub')['val'](_0xde7dx3['title_sub']);
            $('#content')['text'](_0xde7dx3['content']);
            $('#subhead')['val'](_0xde7dx3['subhead']);
            $('#summary')['val'](_0xde7dx3['summary']);
            $('#sort')['val'](_0xde7dx3['sort']);
            $('#ico_img')['attr']('src', domain + _0xde7dx3['ico']);
            $('#selected_ico_img')['attr']('src', domain + _0xde7dx3['selected_ico']);
            $('#picture_url_img')['attr']('src', domain + _0xde7dx3['picture_url']);
            $('#ico')['val'](_0xde7dx3['ico']);
            $('#selected_ico')['val'](_0xde7dx3['selected_ico']);
            $('#picture_url')['val'](_0xde7dx3['picture_url']);
            var _0xde7dx4 = $('#filelist1');
            var _0xde7dx5 = '';
            if (_0xde7dx3['info_img_List'] != null && _0xde7dx3['info_img_List']['length'] > 0) {
                for (var _0xde7dx6 = 0; _0xde7dx6 < _0xde7dx3['info_img_List']['length']; _0xde7dx6++) {
                    _0xde7dx5 = _0xde7dx5 + ('<li id="CWU_FILE_' + _0xde7dx6 + '" draggable="true" class="state-complete" style="display: block;"><div class="item">' + '<p class="title">&nbsp;</p>' + '<p class="imgWrap"><img src="' + domain + _0xde7dx3['info_img_List'][_0xde7dx6] + '"></p>' + '<p class="progress"><span style="display: none; width: 0px;"></span></p>' + '<div class="file-panel" style="height: 30px;"><span class="cancel" onclick="delImg(\'CWU_FILE_' + _0xde7dx6 + '\',' + _0xde7dx6 + ')">\u5220\u9664</span></div>' + '</div><span class="success"></span></li>')
                };
                _0xde7dx4['html'](_0xde7dx5);
                _0xde7dx4['sortable']()
            }
        } else {
            layer['alert']('信息获取失败，请重试！', {
                icon: 5
            })
        }
    }, true, '', 'get')
}
function GetImgList1(_0xde7dx8) {
    ajax('/SystemSetting/GetUserRulePictures/' + _0xde7dx8, {}, function (_0xde7dx3) {
        var _0xde7dx4 = $('#filelist1');
        var _0xde7dx5 = '';
        if (_0xde7dx3 != null && _0xde7dx3['length'] > 0) {
            for (var _0xde7dx6 = 0; _0xde7dx6 < _0xde7dx3['length']; _0xde7dx6++) {
                _0xde7dx5 = _0xde7dx5 + ('<li id="CWU_FILE_' + _0xde7dx6 + '" draggable="true" class="state-complete" style="display: block;"><div class="item">' + '<p class="title">&nbsp;</p>' + '<p class="imgWrap"><img src="' + domain + _0xde7dx3[_0xde7dx6]['url'] + '"></p>' + '<p class="progress"><span style="display: none; width: 0px;"></span></p>' + '<div class="file-panel" style="height: 30px;"><span class="cancel" onclick="delImg(\'CWU_FILE_' + _0xde7dx6 + '\',' + _0xde7dx6 + ')">\u5220\u9664</span></div>' + '</div><span class="success"></span></li>')
            };
            _0xde7dx4['html'](_0xde7dx5);
            _0xde7dx4['sortable']()
        }
    })
}
function delImg(_0xde7dxa, _0xde7dxb) {
    $('#' + _0xde7dxa)['remove']()
}
function SaveUserRule() {
    var _0xde7dxd = [];
    $('#filelist1 .imgWrap img')['each'](function (_0xde7dx6) {
        var _0xde7dxe = $(this)['attr']('src');
        var _0xde7dxf = _0xde7dxe['indexOf']('/upload');
        var _0xde7dx10 = _0xde7dxe['substring'](_0xde7dxf);
        _0xde7dxd['push'](_0xde7dx10)
    });
    var _0xde7dx11 = $('#form-add')['serializeArray']();
    console['log'](_0xde7dx11);
    var _0xde7dx12 = {};
    $['each'](_0xde7dx11, function (_0xde7dx6, _0xde7dx13) {
        _0xde7dx12[_0xde7dx13['name']] = _0xde7dx13['value']
    });
    _0xde7dx12['info_img_List'] = _0xde7dxd;
    console['log'](_0xde7dx12);
    $['ajax']({
        type: 'post',
        url: '/SystemSetting/AddorEditUserRule',
        dataType: 'json',
        data: _0xde7dx12,
        success: function (_0xde7dx3) {
            if (_0xde7dx3['status'] == 'y') {
                layer['msg']('保存成功', {
                    time: 1200
                }, function () {
                    window['location']['href'] = '/systemsetting/UserRule/'
                })
            } else {
                layer['msg'](_0xde7dx3['info'], {
                    time: 2000
                })
            }
        }
    })
}